<?php
class Admin_IndexController extends YouNet_Controller_Action
{   
    private $_page = NULL;
    public function init() 
    {
        parent::init();
        $this->_helper->layout->setLayout('layout_facebook');
    }
    
    public function preDispatch()
    {
        parent::preDispatch();
        
        // View
        $this->view->pages = $this->_social->getUserPages();        
        $this->view->id_page = $this->_social->getIdPage();
        $this->view->params = $this->_params;
    }
    
    /**
     * Index Action
     */
    public function indexAction()
    {        
        $this->_social->redirect('/admin/index/config');
    }
       
    /**
     * Install app into fanpage
     */
    public function configAction() 
    {   
        if (isset($this->_params['id_page']))
        {
            // Ridirect to admin page
            $this->_social->redirect('/admin/config/fans/id_page/'.$this->_params['id_page']);
        }
        $this->view->is_index_config = 1;
    }    
}